package com.centsuse.my_redis.es.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.util.Date;
import java.util.List;

@Document(indexName = "knowledge_index")
public class KnowledgeDocument {

    @Id
    @Field(type = FieldType.Keyword)
    private String taskId;

    @Field(type = FieldType.Keyword, name = "file_id")
    private String fileId;

    @Field(type = FieldType.Keyword, name = "para_id")
    private String paraId;

    @MultiField(mainField = @Field(type = FieldType.Text, analyzer = "ik_max_word", name = "kn_title"),
            otherFields = {
                    @InnerField(suffix = "keyword", type = FieldType.Keyword, ignoreAbove = 256)
            })
    private String knTitle;

    // para_title 字段：同时支持全文检索(para_title)和精确匹配(para_title.keyword)
    @MultiField(mainField = @Field(type = FieldType.Text, analyzer = "ik_max_word", name = "para_title"),
            otherFields = {
                    @InnerField(suffix = "keyword", type = FieldType.Keyword, ignoreAbove = 256)
            })
    private String paraTitle;

    // summary 字段：同时支持全文检索(summary)和精确匹配(summary.keyword)
    @MultiField(mainField = @Field(type = FieldType.Text, analyzer = "ik_max_word", name = "summary"),
            otherFields = {
                    @InnerField(suffix = "keyword", type = FieldType.Keyword, ignoreAbove = 256)
            })
    private String summary;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", name = "content")
    private String content;

    @Field(type = FieldType.Keyword, name = "vectorized_flag")
    private String vectorizedFlag;

    @Field(type = FieldType.Keyword, name = "scene_codes")
    private List<String> sceneCodes;

    @Field(type = FieldType.Keyword, name = "visible_tags")
    private List<String> visibleTags;

    @Field(type = FieldType.Keyword, name = "usable_tags")
    private List<String> usableTags;

    @Field(type = FieldType.Keyword, name = "source_org_id")
    private String sourceOrgId;

    @Field(type = FieldType.Keyword, name = "source_system")
    private String sourceSystem;

    @Field(type = FieldType.Keyword, name = "customized_tags")
    private List<String> customizedTags;

    @Field(type = FieldType.Date, format = {}, name = "create_time")
    private Date createTime;

    @Field(type = FieldType.Date, format = {}, name = "update_time")
    private Date updateTime;

    @Field(type = FieldType.Keyword, name = "published_flag")
    private String publishedFlag;

    @Field(type = FieldType.Keyword, name = "kn_type")
    private String knType;

    @Field(type = FieldType.Keyword, name = "latest_flag")
    private String latestFlag;

    @Field(type = FieldType.Keyword, name = "del_flag")
    private String delFlag;

    // 省略getter和setter方法

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public String getFileId() {
        return fileId;
    }

    public void setFileId(String fileId) {
        this.fileId = fileId;
    }

    public String getParaId() {
        return paraId;
    }

    public void setParaId(String paraId) {
        this.paraId = paraId;
    }

    public String getKnTitle() {
        return knTitle;
    }

    public void setKnTitle(String knTitle) {
        this.knTitle = knTitle;
    }

    public String getParaTitle() {
        return paraTitle;
    }

    public void setParaTitle(String paraTitle) {
        this.paraTitle = paraTitle;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getVectorizedFlag() {
        return vectorizedFlag;
    }

    public void setVectorizedFlag(String vectorizedFlag) {
        this.vectorizedFlag = vectorizedFlag;
    }

    public List<String> getSceneCodes() {
        return sceneCodes;
    }

    public void setSceneCodes(List<String> sceneCodes) {
        this.sceneCodes = sceneCodes;
    }

    public List<String> getVisibleTags() {
        return visibleTags;
    }

    public void setVisibleTags(List<String> visibleTags) {
        this.visibleTags = visibleTags;
    }

    public List<String> getUsableTags() {
        return usableTags;
    }

    public void setUsableTags(List<String> usableTags) {
        this.usableTags = usableTags;
    }

    public String getSourceOrgId() {
        return sourceOrgId;
    }

    public void setSourceOrgId(String sourceOrgId) {
        this.sourceOrgId = sourceOrgId;
    }

    public String getSourceSystem() {
        return sourceSystem;
    }

    public void setSourceSystem(String sourceSystem) {
        this.sourceSystem = sourceSystem;
    }

    public List<String> getCustomizedTags() {
        return customizedTags;
    }

    public void setCustomizedTags(List<String> customizedTags) {
        this.customizedTags = customizedTags;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getPublishedFlag() {
        return publishedFlag;
    }

    public void setPublishedFlag(String publishedFlag) {
        this.publishedFlag = publishedFlag;
    }

    public String getKnType() {
        return knType;
    }

    public void setKnType(String knType) {
        this.knType = knType;
    }

    public String getLatestFlag() {
        return latestFlag;
    }

    public void setLatestFlag(String latestFlag) {
        this.latestFlag = latestFlag;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }
}